#ifndef NETWORKSETTINGSDIALOG_H
#define NETWORKSETTINGSDIALOG_H

#include <QDialog>

namespace Ui {
    class NetworkSettingsDialog;
}

class RcSession;

/**
  * For Forum Nokia account and proxy settings.
  *
  * If RcSession is not NULL, then the dialog can be
  * used for signing in or out, depending on what
  * the current sign in state is
  * (cf bool RcSession::isSignedOn()).
  *
  * If RcSession is NULL, then this is used only
  * for persisting settings.
  */
class NetworkSettingsDialog : public QDialog {
    Q_OBJECT
public:

    /**
      * @param rcSession the RcSession instance to use to
      *        sign in / out. It may be NULL, the dialog
      *        is not used for signing in/out, only for
      *        persisting settings.
      */
    NetworkSettingsDialog(RcSession * rcSession,
                          QWidget   * parent = 0);
    ~NetworkSettingsDialog();

    bool justSignedIn() const;

public slots:
    virtual void accept();

private slots:
    void on_manualProxy_toggled(bool toggle);
    void rcSessionSignedInSlot(bool success);

protected:
    void changeEvent(QEvent *e);

private:
    Ui::NetworkSettingsDialog * ui;
    RcSession                 * m_rcSession;
    bool                        m_justSignedIn;

    void setEnableManualProxyWidgets(bool enabled);
    void persistSettings();
    void updateSignedOnAppearance();
};

#endif // NETWORKSETTINGSDIALOG_H
